﻿<local:DocumentBase x:Class="WPFExcelReport.MVTVK02"
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
          xmlns:local="clr-namespace:ReflectionStudio.Components.UserControls;assembly=ReflectionStudio.Core" 
                    xmlns:ChartEx="clr-namespace:WPFExcelReport.Chart;assembly=ITXVIEWS"
        xmlns:wep="clr-namespace:WPFExcelReport" 
       Background="White" 
         Loaded="Window_Loaded"
     >
    <TabControl>
        <TabItem Header="查询">
            <Grid DataContext="{Binding}">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="1*" />
        </Grid.RowDefinitions>

        <WrapPanel >
            <Label Content="下单日期从" Height="26" HorizontalAlignment="Left" Margin="10,5,0,0" Name="label1" VerticalAlignment="Top" Width="87" FontSize="16" />
            <DatePicker Height="25" HorizontalAlignment="Left" Margin="0,2,0,0" Name="FROM_DATE" VerticalAlignment="Top" 
                                SelectedDateChanged ="FROM_DATE_SelectedDateChanged" Width="111" />
            <Label Content="至" Height="28" HorizontalAlignment="Left" Margin="10,5,0,0" Name="label2" VerticalAlignment="Top" Width="19" FontSize="16" />
            <DatePicker Height="25" HorizontalAlignment="Left" Margin="0,2,0,0" Name="END_DATE" VerticalAlignment="Top" 
                                SelectedDateChanged ="END_DATE_SelectedDateChanged" Width="113" />
            <Button Content="查询" Height="33" Margin="10,0,0,0"  Name="btnQuery" Width="122" Panel.ZIndex="8"
                        Click="btnQuery_Click"/>
            <Button Content="导出" Height="33" Margin="10,0,0,0"  Name="btnEXCEL" Width="122" Panel.ZIndex="9"
                        Click="btnEXCEL_Click"/>
        </WrapPanel>

        <DataGrid Grid.Row="1"
                  CanUserReorderColumns="True"  
                  CanUserResizeRows="True" CanUserSortColumns="True" 
                  AutoGenerateColumns="False"   
                  EnableRowVirtualization="True"   
                  EnableColumnVirtualization="True"  
                  ScrollViewer.HorizontalScrollBarVisibility="Auto"
                  ScrollViewer.VerticalScrollBarVisibility="Auto"
                  RowDetailsVisibilityMode="VisibleWhenSelected" 
                  HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
                  IsSynchronizedWithCurrentItem="True"
                  ItemsSource="{Binding}" x:Name="MasterDg" 
                  Margin="0,10,0,0"  >
            <DataGrid.Columns>
                <DataGridTextColumn Binding="{Binding Path=PI}" Header="PI" Width="SizeToCells" MinWidth="50" />
                <DataGridTextColumn Binding="{Binding Path=CUSTOMER}" Header="Customer" Width="SizeToCells" MinWidth="70" MaxWidth="100" />
                <DataGridTextColumn Binding="{Binding Path=COUNTRY}" Header="Country" Width="SizeToCells" MinWidth="30" />
                <DataGridTextColumn Binding="{Binding Path=PROVINCE}" Header="Province" Width="SizeToCells" MinWidth="40" MaxWidth="70"/>
                <DataGridTextColumn Binding="{Binding Path=MERCHANDISER}" Header="Merchandiser" Width="SizeToCells" MinWidth="40" />
                <DataGridTextColumn Binding="{Binding Path=ENTRYDATE}" Header="EntryDate" Width="SizeToCells" MinWidth="40" />
                <DataGridTextColumn Binding="{Binding Path=ENDCUSTOMER}" Header="EndCustomer" Width="SizeToCells" MinWidth="50" MaxWidth="70"/>
                <DataGridTextColumn Binding="{Binding Path=CURRENCY}" Header="Currency" Width="SizeToCells" MinWidth="30" />
                <DataGridTextColumn Binding="{Binding Path=TYPE}" Header="Type" Width="SizeToCells" MinWidth="30" />
                <DataGridTextColumn Binding="{Binding Path=ARTICLE}" Header="Article" Width="SizeToCells" MinWidth="50" MaxWidth="100" />
                <DataGridTextColumn Binding="{Binding Path=COLOR}" Header="Color" Width="SizeToCells" MinWidth="50" />
                <DataGridTextColumn Binding="{Binding Path=QTY}" Header="Quantity" Width="SizeToCells" MinWidth="40" />
                <DataGridTextColumn Binding="{Binding Path=QTYUNIT}" Header="Unit" Width="SizeToCells" MinWidth="30" />
                <DataGridTextColumn Binding="{Binding Path=DELIVERYDATE}" Header="DeliveryDate" Width="SizeToCells" MinWidth="50" />
                <DataGridTextColumn Binding="{Binding Path=PRICE}" Header="Price" Width="SizeToCells" MinWidth="40" />
                <DataGridTextColumn Binding="{Binding Path=PRICEUNIT}" Header="Unit" Width="SizeToCells" MinWidth="30" />
                <DataGridTextColumn Binding="{Binding Path=TOTVALUES}" Header="Values" Width="SizeToCells" MinWidth="50" />
            </DataGrid.Columns>
        </DataGrid>
    </Grid>            
        </TabItem>
        <TabItem Header="图表">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"></RowDefinition>
                    <RowDefinition Height="1*"></RowDefinition>
                </Grid.RowDefinitions>
                <WrapPanel>
                    <Button Content="初始化" Height="33" Margin="10,0,0,0"  Width="122" Panel.ZIndex="8"
                        Click="btnCharting_Click"/>
                </WrapPanel>
                <ScrollViewer Grid.Row="1" Grid.Column="1" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" >
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"></RowDefinition>
                            <RowDefinition Height="Auto"></RowDefinition>
                        </Grid.RowDefinitions>
                        <ChartEx:ChartEx0004 Grid.Row="0"   Name="Chart04" />
                    </Grid>
                </ScrollViewer>
            </Grid>
        </TabItem> 
    </TabControl>
</local:DocumentBase>
